﻿/*------------------------------------------------
// File Description: SortRecord DataBase Entity
// Author:			 Crane
// Create Time:		 2020-12-26 15:21:38
//------------------------------------------------*/

using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IOA.MES.DataAccess.Entity
{
    /// <summary>
    /// 组件分拣记录
    /// </summary>
    [Table(nameof(SortRecord))]
    public class SortRecord : BaseEntity
    {
        private string _barCode = string.Empty;
        private string _workshopCode = string.Empty;
        private string _workshopName = string.Empty;
        private string _productCode = string.Empty;
        private string _productName = string.Empty;
        private string _productSpecs = string.Empty;
        private string _machineNo = string.Empty;
        private string _machineName = string.Empty;
        private string _orderNo = string.Empty;
        private string _workOrderNo = string.Empty;
        private string _nameplateModel = string.Empty;
        private string _currentLevel = string.Empty;
        private string _qLevel = string.Empty;
        private string _componentColor = string.Empty;
        private string _junBoxSpecs = string.Empty;
        private string _junBoxFactory = string.Empty;
        private string _backPlanSpecs = string.Empty;
        private string _backPlanFactory = string.Empty;
        private string _aluFrameSpecs = string.Empty;
        private string _aluFrameFactory = string.Empty;
        private string _batterySpecs = string.Empty;
        private string _batteryFactory = string.Empty;
        private string _lineName = string.Empty;
        private string _badReason = string.Empty;

        #region Public Property

        ///<Summary>
        /// 条码
        ///</Summary>
        public string BarCode
        {
            get { return string.IsNullOrWhiteSpace(_barCode) ? string.Empty : _barCode; }
            set { _barCode = value; }
        }

        ///<Summary>
        /// 车间代码
        ///</Summary>
        public string WorkshopCode
        {
            get { return string.IsNullOrWhiteSpace(_workshopCode) ? string.Empty : _workshopCode; }
            set { _workshopCode = value; }
        }

        ///<Summary>
        /// 车间名称
        ///</Summary>
        public string WorkshopName
        {
            get { return string.IsNullOrWhiteSpace(_workshopName) ? string.Empty : _workshopName; }
            set { _workshopName = value; }
        }

        ///<Summary>
        /// 产品代码
        ///</Summary>
        public string ProductCode
        {
            get { return string.IsNullOrWhiteSpace(_productCode) ? string.Empty : _productCode; }
            set { _productCode = value; }
        }

        ///<Summary>
        /// 产品名称
        ///</Summary>
        public string ProductName
        {
            get { return string.IsNullOrWhiteSpace(_productName) ? string.Empty : _productName; }
            set { _productName = value; }
        }

        ///<Summary>
        /// 产品规格
        ///</Summary>
        public string ProductSpecs
        {
            get { return string.IsNullOrWhiteSpace(_productSpecs) ? string.Empty : _productSpecs; }
            set { _productSpecs = value; }
        }

        ///<Summary>
        /// 流水线ID
        ///</Summary>
        public int LineId { get; set; }

        ///<Summary>
        /// 流水线名称
        ///</Summary>
        public string LineName
        {
            get { return string.IsNullOrWhiteSpace(_lineName) ? string.Empty : _lineName; }
            set { _lineName = value; }
        }

        ///<Summary>
        /// 设备ID
        ///</Summary>
        public int MachineId { get; set; }

        ///<Summary>
        /// 设备编码
        ///</Summary>
        public string MachineNo
        {
            get { return string.IsNullOrWhiteSpace(_machineNo) ? string.Empty : _machineNo; }
            set { _machineNo = value; }
        }

        ///<Summary>
        /// 设备名称
        ///</Summary>
        public string MachineName
        {
            get { return string.IsNullOrWhiteSpace(_machineName) ? string.Empty : _machineName; }
            set { _machineName = value; }
        }

        ///<Summary>
        /// 分拣规则ID
        ///</Summary>
        public int RuleId { get; set; }

        ///<Summary>
        /// 堆号
        ///</Summary>
        public int StackNo { get; set; }

        ///<Summary>
        /// 满托数量
        ///</Summary>
        public int FullCount { get; set; }

        ///<Summary>
        /// 堆ID
        ///</Summary>
        public int StackId { get; set; }

        ///<Summary>
        /// 堆放序号
        ///</Summary>
        public int SortNo { get; set; }

        ///<Summary>
        /// 是否包护角
        ///</Summary>
        public bool? FootProtect { get; set; }

        ///<Summary>
        /// 是否翻转
        ///</Summary>
        public bool? OverTurn { get; set; }

        ///<Summary>
        /// 是否已分拣
        ///</Summary>
        public bool Sorted { get; set; } = false;

        ///<Summary>
        /// 订单号
        ///</Summary>
        public string OrderNo
        {
            get { return string.IsNullOrWhiteSpace(_orderNo) ? string.Empty : _orderNo; }
            set { _orderNo = value; }
        }

        ///<Summary>
        /// 工单号
        ///</Summary>
        public string WorkOrderNo
        {
            get { return string.IsNullOrWhiteSpace(_workOrderNo) ? string.Empty : _workOrderNo; }
            set { _workOrderNo = value; }
        }

        ///<Summary>
        /// 铭牌型号
        ///</Summary>
        public string NameplateModel
        {
            get { return string.IsNullOrWhiteSpace(_nameplateModel) ? string.Empty : _nameplateModel; }
            set { _nameplateModel = value; }
        }

        ///<Summary>
        /// 功率档
        ///</Summary>
        public decimal? PowerLevel { get; set; }

        ///<Summary>
        /// 电流档
        ///</Summary>
        public string CurrentLevel
        {
            get { return string.IsNullOrWhiteSpace(_currentLevel) ? string.Empty : _currentLevel; }
            set { _currentLevel = value; }
        }

        ///<Summary>
        /// 质量等级
        ///</Summary>
        public string QLevel
        {
            get { return string.IsNullOrWhiteSpace(_qLevel) ? string.Empty : _qLevel; }
            set { _qLevel = value; }
        }

        ///<Summary>
        /// 组件颜色
        ///</Summary>
        public string ComponentColor
        {
            get { return string.IsNullOrWhiteSpace(_componentColor) ? string.Empty : _componentColor; }
            set { _componentColor = value; }
        }

        ///<Summary>
        /// 接线盒规格
        ///</Summary>
        public string JunBoxSpecs
        {
            get { return string.IsNullOrWhiteSpace(_junBoxSpecs) ? string.Empty : _junBoxSpecs; }
            set { _junBoxSpecs = value; }
        }

        ///<Summary>
        /// 接线盒厂家
        ///</Summary>
        public string JunBoxFactory
        {
            get { return string.IsNullOrWhiteSpace(_junBoxFactory) ? string.Empty : _junBoxFactory; }
            set { _junBoxFactory = value; }
        }

        ///<Summary>
        /// 背板规格
        ///</Summary>
        public string BackPlanSpecs
        {
            get { return string.IsNullOrWhiteSpace(_backPlanSpecs) ? string.Empty : _backPlanSpecs; }
            set { _backPlanSpecs = value; }
        }

        ///<Summary>
        /// 背板厂家
        ///</Summary>
        public string BackPlanFactory
        {
            get { return string.IsNullOrWhiteSpace(_backPlanFactory) ? string.Empty : _backPlanFactory; }
            set { _backPlanFactory = value; }
        }

        ///<Summary>
        /// 铝框规格
        ///</Summary>
        public string AluFrameSpecs
        {
            get { return string.IsNullOrWhiteSpace(_aluFrameSpecs) ? string.Empty : _aluFrameSpecs; }
            set { _aluFrameSpecs = value; }
        }

        ///<Summary>
        /// 铝框厂家
        ///</Summary>
        public string AluFrameFactory
        {
            get { return string.IsNullOrWhiteSpace(_aluFrameFactory) ? string.Empty : _aluFrameFactory; }
            set { _aluFrameFactory = value; }
        }

        ///<Summary>
        /// 电池片规格
        ///</Summary>
        public string BatterySpecs
        {
            get { return string.IsNullOrWhiteSpace(_batterySpecs) ? string.Empty : _batterySpecs; }
            set { _batterySpecs = value; }
        }

        ///<Summary>
        /// 电池片厂家
        ///</Summary>
        public string BatteryFactory
        {
            get { return string.IsNullOrWhiteSpace(_batteryFactory) ? string.Empty : _batteryFactory; }
            set { _batteryFactory = value; }
        }

        ///<Summary>
        /// 异常
        ///</Summary>
        public string BadReason
        {
            get { return string.IsNullOrWhiteSpace(_badReason) ? string.Empty : _badReason; }
            set { _badReason = value; }
        }

        ///<Summary>
        /// 堆放状态
        ///</Summary>
        public Enum.SortRecordStatus Status { get; set; } = Enum.SortRecordStatus.Normal;
        #endregion
    }

    public partial class MESContext
    {
        /// <summary>
        /// 组件分拣记录
        /// </summary>
        public virtual DbSet<SortRecord> SortRecords { get; set; }
    }
}